﻿
CREATE PROCEDURE [dbo].[fares_CautaArticole]
	-- Add the parameters for the stored procedure here
	@CodUnitate smallint,
	@CodArticol varchar(50),
	@Denumire varchar(100),
	@ContArticol TipCont,
	@ContCheltuiala TipCont,
	@IDCategorie smallint
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT * FROM Articole
	WHERE CodUnitate=@CodUnitate and 
	(@CodArticol='' OR CodArticol LIKE '%' + @CodArticol + '%') AND
	(@Denumire='' OR Denumire LIKE '%' + @Denumire + '%') AND 
	(@ContArticol='' OR Cont = @ContArticol) AND 
	(@ContCheltuiala='' OR ContCheltuiala =@ContCheltuiala) AND
	(@IDCategorie=-1 OR IDCategorie = @IDCategorie)
	
END